<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>自定义函数</title>
		<script>
			//Gloabal
			function add(a,b){
				console.log(a+b);
				return a+b;
			}
			alert(add("hello","world"));
			alert(add(22,4));
			
			function printHello(n){
				for(let i=0;i<n;i++){
					document.write("<h1>hello</h1>");
				}
			}
			printHello(3);
		</script>
	</head>
	<body>
		<input type="button" value="加法" onclick="add(4,9)" />
		
		<input type="button" value="输出hello" onclick="printHello(prompt('input a number:'))" />
 	</body>
</html>